package com.homegoods.classify.item;

import com.alibaba.android.arouter.launcher.ARouter;
import com.homegoods.classify.R;
import com.homegoods.classify.model.GoodsModel;
import com.homegoods.resource.Itemable;
import com.homegoods.aroutercomment.ARouterPath;
import com.kedll.library.adapter.MultiTypeAdapter;

/**
 * @author QiQi
 * @date 2017/5/7
 * @descrip 分类模块里的产品项
 */

public class GoodsItem extends Itemable<GoodsModel> {

    public GoodsItem(GoodsModel model, MultiTypeAdapter adapter) {
        super(model);
        setOnClickListener(v -> ARouter.getInstance()
                .build(ARouterPath.PATH_GOODS_DETAIL)
                .withString("id", model.sid)
                .navigation());
    }

    @Override
    public int getLayout() {
        return R.layout.item_goods_layout;
    }

    @Override
    public String getImage() {
        return getData().avatar;
    }

    @Override
    public String getTitle() {
        return getData().title;
    }
}
